import { followDoctorAPI } from '@/apis/doctor.js'

//关注医生
export const useFollow = (type='doc') => {
	const onFollowButtonClick = async(item) => {
		// console.log(item)
		uni.showLoading({
			title:item.likeFlag === 1 ? '取消关注中...' : ' 关注中...',
		})
		
		await followDoctorAPI(item.id,type)
			// 关注成功
			item.likeFlag = item.likeFlag === 1 ? 0 : 1
			uni.hideLoading()
		}
	return { onFollowButtonClick }
}